package com.hospital.system.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.hospital.system.entity.User;
import com.hospital.system.service.UserService;

@Controller
public class PageController {
	
	 @Autowired
	   private UserService userService;
	 @RequestMapping("toArea")
	    public String toArea() {
	    	return "views/center/area.html";
	    }
		
	    @RequestMapping("toDepartments")
	    public String toDepartments() {
//	    	System.out.println("跳转页面");
	        return "views/center/departments.html";
	    }
	    @RequestMapping("toDoctor")
	    public String toDoctor() {
	        return "views/center/doctor.html";
	    }
	    @RequestMapping("toRegisteredType")
	    public String toRegisteredtype() {
	        return "views/center/registeredType.html";
	    }
	    @RequestMapping("toProjectTypeManage")
	    public String toProjectTypeManage() {
	        return "views/center/projectTypeManage.html";
	    }
	//跳转到登录页面
	@RequestMapping("/toLogin")
	public String toLogin() {
		return "/views/login";
	}
	//退出用户，跳转到登录页面
	@RequestMapping("/logout")
	public String toLogout(HttpServletRequest request) {
		request.getSession().removeAttribute("user");
		return "/views/login";
	}
	//跳转至首页
	@RequestMapping("/toIndex")
	public String toIndex() {
		return "/views/index";
	}	
	//跳转管理用户
    @RequestMapping("/toUserManage")
    public String toUserMnager() {
        return "views/system/userlist";
    }
    //跳转管理菜单
    @RequestMapping("/toMenuManage")
    public String toMenuMnager() {
    	return "views/system/menulist";
    }
    //跳转加载菜单管理左边的菜单树
    @RequestMapping("/toMenuLeft")
    public String toMenuLeft() {
        return "views/system/menuLeft";
    }

    //跳转加载菜单管理左边的增删改
    @RequestMapping("/toMenuRight")
    public String toMenuRight() {
        return "views/system/menuRight";
    }
    //跳转到角色管理页面
    @RequestMapping("/toRoleManage")
    public String toRoleMnager() {
    	return "views/system/rolelist";
    }
    //跳转到角色个人信息页面
    @RequestMapping("/toUpdateLogin")
    public String toUpdateLogin(Integer user_id, Model model) {
        User user = userService.findUserByLoginUser_id(user_id);
        model.addAttribute("usersLogin",user);
        return "views/system/updateLogin";
    }
    //跳转到图标管理页面
    @RequestMapping("/toIconManage")
    public String toIconManage() {
    	return "views/system/icon";
    }
    
}
